package com.example.kotlin.scrollingtable.java_type3;

import android.support.v7.widget.LinearLayoutManager;
import android.text.TextUtils;
import android.view.LayoutInflater;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewGroup;
import android.widget.LinearLayout;
import android.widget.TextView;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.example.kotlin.scrollingtable.R;
import com.example.kotlin.scrollingtable.java_type3.model.JavaRvType3LeftAdapter;
import com.example.kotlin.scrollingtable.java_type3.model.JavaType3ProductModel;
import com.example.kotlin.scrollingtable.type3.model.Type3PriceModel;

import org.jetbrains.annotations.Nullable;

import java.util.Iterator;
import java.util.List;

import kotlin.jvm.internal.Intrinsics;

/**
 * Created by admin  2019/11/28/14:10
 * Describe
 * 作者 洪亮 admin
 */
public class JavaRvType3RightAdapter extends BaseQuickAdapter<JavaType3ProductModel, BaseViewHolder> {

    public JavaRvType3RightAdapter(int layoutResId, List list) {
        super(layoutResId, list);
    }

    private LinearLayoutManager mLeftLinearLayoutManager;
    private JavaRvType3LeftAdapter mRvType3LeftAdapter;

    public final LinearLayoutManager getMLeftLinearLayoutManager() {
        return this.mLeftLinearLayoutManager;
    }

    public final void setMLeftLinearLayoutManager(@Nullable LinearLayoutManager var1) {
        this.mLeftLinearLayoutManager = var1;
    }

    public final JavaRvType3LeftAdapter getMRvType3LeftAdapter() {
        return this.mRvType3LeftAdapter;
    }

    public final void setMRvType3LeftAdapter(@Nullable JavaRvType3LeftAdapter var1) {
        this.mRvType3LeftAdapter = var1;
    }


    @Override
    protected void convert(final BaseViewHolder helper, final JavaType3ProductModel item) {

        LinearLayout ll_item = helper.getView(R.id.ll_item);
        ll_item.removeAllViews();
        for (int i = 0; i < item.getmRightDataList().size(); i++) {
            View inflate = LayoutInflater.from(mContext).inflate(R.layout.item_layout, null);
            TextView textView = inflate.findViewById(R.id.tv_data);
            textView.setText(item.getmRightDataList().get(i).getPriceName());
            ll_item.addView(inflate);
        }

//        final int productPosition = helper.getAdapterPosition();
//        LinearLayout ll_item = helper.getView(R.id.ll_item);
//        ll_item.removeAllViews();
//        List mRightDataList = item.getMRightDataList();
//        for (int i = 0; i < mRightDataList.size(); i++) {
//            View itemView = this.getItemView(R.layout.item_layout, null);
//            TextView tv_data = itemView.findViewById(R.id.tv_data);
//            tv_data.setText(item.getProductName());
//            ll_item.addView(itemView);
//        }
//
//        helper.itemView.setPressed(item.isPressed());
//        helper.itemView.setOnTouchListener(new View.OnTouchListener() {
//            public final boolean onTouch(View view, MotionEvent event) {
//                View var3;
//                switch (event.getAction()) {
//                    case 0:
//                        var3 = helper.itemView;
//                        var3.setPressed(true);
//                        item.setPressed(true);
//                        break;
//                    case 1:
//                    case 3:
//                        var3 = helper.itemView;
//                        var3.setPressed(false);
//                        item.setPressed(false);
//                    case 2:
//                    default:
//                        break;
//                }
//                JavaRvType3LeftAdapter var4 = JavaRvType3RightAdapter.this.getMRvType3LeftAdapter();
//                if (var4 != null) {
//                    var4.notifyItemChanged(productPosition);
//                }
//                return false;
//            }
//        });
    }
}
